package com.appkubes.mall.core.service.impl;

//核心包
import com.appkubes.base.core.mbp.impl.AbstractBaseServiceImpl;
import com.appkubes.mall.core.dao.BaseMallAdminDao;
import com.appkubes.mall.core.entity.MallAdmin;
import com.appkubes.mall.core.service.BaseMallAdminService;

//依赖库
import com.appkubes.base.core.entity.vo.PageVO;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.context.annotation.Primary;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author Rongjie
 * @description
 */

@Service
@Primary
public class BaseMallAdminServiceImpl extends AbstractBaseServiceImpl<BaseMallAdminDao,MallAdmin> implements BaseMallAdminService {

    @Override
    public MallAdmin getOneByEntity(MallAdmin entity) {
        QueryWrapper<MallAdmin> queryWrapper = new QueryWrapper<>();
        queryWrapper.setEntity(entity);
        return this.getOne(queryWrapper, false);
    }

    @Override
    public List<MallAdmin> selectListByEntity(MallAdmin entity) {
        QueryWrapper<MallAdmin> queryWrapper = new QueryWrapper<>();
        queryWrapper.setEntity(entity);
        return this.baseMapper.selectList(queryWrapper);
    }
    
    @Override
    public IPage<MallAdmin> selectPageByEntity(IPage<MallAdmin> page) {
        MallAdmin MallAdmin = new MallAdmin();
        return selectPageByEntity(MallAdmin, page);
    }

    @Override
    public IPage<MallAdmin> selectPageByEntity(PageVO pageVO) {
        MallAdmin MallAdmin = new MallAdmin();
        return selectPageByEntity(MallAdmin, pageVO);
    }

    @Override
    public IPage<MallAdmin> selectPageByEntity(MallAdmin entity, IPage<MallAdmin> page) {
        QueryWrapper<MallAdmin> queryWrapper = new QueryWrapper<>();
        queryWrapper.setEntity(entity);
        return this.baseMapper.selectPage(page, queryWrapper);
    }

    @Override
    public IPage<MallAdmin> selectPageByEntity(MallAdmin entity, PageVO pageVO) {
        return selectPageByEntity(entity, pageVO.getPage(), pageVO.getSize());
    }

    @Override
    public IPage<MallAdmin> selectPageByEntity(MallAdmin entity, Integer pageNo, Integer pageSize) {
        Page page = new Page<>(pageNo, pageSize);
        QueryWrapper<MallAdmin> queryWrapper = new QueryWrapper<>();
        queryWrapper.setEntity(entity);
        return this.baseMapper.selectPage(page, queryWrapper);
    }

    @Override
    public Boolean removeByEntity(MallAdmin entity) {
        QueryWrapper<MallAdmin> queryWrapper = new QueryWrapper<>();
        queryWrapper.setEntity(entity);
        return this.remove(queryWrapper);
    }
}
